<? FoundryView::includeTpl( 'adminMain:header' ) ?>

<script type="text/javascript" src="<?=Foundry::config('webpath')?>/javascript/admin/userRules.js"></script>


<div id="mainContent">

	<h2>Users</h2>
	
	<a href="<?=FoundryView::helperLinkTo( 'userAdmin/edit' )?>" class="actionLink">
		<img src="<?=Foundry::config('webpath')?>/images/admin/add.png" />
		new user</a>
	<span id="actionMessage"></span>
	<p />
	
	<?php
		$model = FoundryController::model( 'user' );
		$users = $model->find( 'order by *fullname asc' );		
	?>
		
	<ul class="assetList">
	<? foreach( $users as $user ) : ?>
	
		<li id="userContainer<?=$user->uid?>">
			<span class="label">
			<a href="<?=FoundryView::helperLinkTo( 'userAdmin/edit' )?>/<?=$user->uid?>"><?=$user->fullname?></a>
			</span>
			<span class="describe">
				group: <?=$user->group_name?>
			</span>
			<span class="icons">
			<img src="<?=Foundry::config('webpath')?>/images/admin/cross.png" title="Delete this user" class="userDelete" for="<?=$user->uid?>" />
			</span>

		</li>
		<li id="infoBumper<?=$user->uid?>" style="display: none"></li>
	
	<? endforeach ?>
	</ul>


	<h2>Groups</h2>
	
	<a href="<?=FoundryView::helperLinkTo( 'userAdmin/editGroup' )?>" class="actionLink">
		<img src="<?=Foundry::config('webpath')?>/images/admin/add.png" />
		new group</a>
	<p />
	
	<?php
		$model = FoundryController::model( 'group' );
		$groups = $model->find( 'order by *name asc' );		
	?>
		
	<ul class="assetList">
	<? foreach( $groups as $group ) : ?>
	
		<li id="groupContainer<?=$group->uid?>">
			<span class="label">
			<a href="<?=FoundryView::helperLinkTo( 'userAdmin/editGroup' )?>/<?=$group->uid?>"><?=$group->name?></a>
			</span>
			<span class="icons">
			<? if( is_array( $group->role ) ) : ?>
				<img src="<?=Foundry::config('webpath')?>/images/admin/cross.png" title="Delete this group" class="groupDelete" for="<?=$group->uid?>" />
			<? else : ?>
				<img src="<?=Foundry::config('webpath')?>/images/admin/cross_disabled.png" title="This group is locked" />
			<? endif ?>
			</span>

		</li>
		<li id="infoBumper<?=$group->uid?>" style="display: none"></li>
	
	<? endforeach ?>
	</ul>


</div>

<? FoundryView::includeTpl( 'adminMain:footer' ) ?>